package com.vdg.lockphotos.data;

import java.io.File;
import java.util.ArrayList;

public class Album {
	private String mName;
	private ArrayList<Photo> mListPhotos;

	public ArrayList<Photo> getListPhotos() {
		return mListPhotos;
	}

	public void setListPhotos(ArrayList<Photo> mListPhotos) {
		this.mListPhotos = mListPhotos;
	}

	public Album(String albumUrl) {
		File file = new File(albumUrl);
		mName = file.getName();
		mListPhotos = new ArrayList<Photo>();
	}

	public String getName() {
		return mName;
	}

	public void setName(String mName) {
		this.mName = mName;
	}

	public static boolean isExist(ArrayList<Album> listAlbum, String albumname) {
		for (Album album : listAlbum) {
			if (album.getName().equals(albumname)) {
				return true;
			}
		}
		return false;
	}

	public static void insetToListAlbum(ArrayList<Album> listAlbum, Photo photo) {
		for (Album album : listAlbum) {
			if (album.getName().equals(photo.getAlbumName())) {
				album.getListPhotos().add(photo);
			}
		}
	}

}
